<?php include $this->admin_tpl('meta');?>
<title>栏目管理 - YzmCMS内容管理系统</title>
<style>.parentid,.yzm-tree-toggle{cursor:pointer;user-select:none}</style>
</head>
<body>
<nav class="breadcrumb"><i class="yzm-iconfont yzm-iconai-home"></i> 首页 <span class="c-gray en">&gt;</span> 内容管理 <span class="c-gray en">&gt;</span> 栏目管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="yzm-iconfont yzm-iconshuaxin"></i></a></nav>
<div class="page-container">
	<div class="cl tb-top"> 
		<span class="l">
			<a href="javascript:;" onclick="yzm_open('添加栏目','<?php echo U('add', array('type'=>0));?>',800,500)" class="btn btn-primary radius"><i class="yzm-iconfont yzm-icontianjia"></i> 添加栏目</a> 
			<a href="javascript:;" onclick="yzm_open('添加单页','<?php echo U('add', array('type'=>1));?>',800,500)" class="btn btn-secondary radius"><i class="yzm-iconfont yzm-icontianjia"></i> 添加单页</a> 
			<a href="javascript:;" onclick="yzm_open('添加外部链接','<?php echo U('add', array('type'=>2));?>',800,500)" class="btn btn-success radius"><i class="yzm-iconfont yzm-icontianjia"></i> 添加外部链接</a>
			<a href="javascript:;" onclick="yzm_open('批量添加','<?php echo U('adds');?>',800,510)" class="btn btn-primary radius"><i class="yzm-iconfont yzm-icontianjia"></i> 批量添加</a>
		</span>
	</div>
	<form action="<?php echo U('order');?>" method="post">
	<table class="table table-border table-bg table-hover">
		<thead>
			<tr class="text-c">
				<th width="60">排序</th>
				<th width="60">栏目ID</th>
				<th class="text-l"><i class="yzm-iconfont yzm-iconshousuojianhao yzm-tree-toggle" isshow="1" onclick="yzm_tree_toggle(this)"></i> 栏目名称</th>
				<th width="80">栏目类型</th>
				<th width="100">所属模型</th>		
				<th width="80">链接地址</th>		
				<th width="80">导航显示</th>
				<th width="80">允许投稿</th>
				<th width="210">管理操作</th>
			</tr>
		</thead>
		<tbody>
				<?php echo $categorys;?>
		</tbody>
	</table>
	<?php if(!$data){ ?><div class="yzm_no_data"><i class="yzm-iconfont yzm-iconshuoming"></i> 暂无数据</div><?php } ?>
	<div class="cl mt-5"> <span class="l"><input class="orderbutton btn-primary radius" name="dosubmit" value="排序" type="submit"></span></div>
	</form>
</div>
<?php include $this->admin_tpl('footer');?>
<script type="text/javascript">

  	function yzm_tree_toggle(obj) {
		$(".parentid").each(function () {
            $(this).trigger('click');
        })
		var isshow = $(obj).attr("isshow");
		if(isshow == "0"){
			$(obj).attr("isshow", "1");
			$(obj).removeClass("yzm-iconshousuojiahao").addClass("yzm-iconshousuojianhao");
		}else{
			$(obj).attr("isshow", "0");
			$(obj).removeClass("yzm-iconshousuojianhao").addClass("yzm-iconshousuojiahao");
		}
    }

    $(".parentid").click(function () {
        var action = parseInt($(this).attr("action"));
        var tr = $(this).parents('tr').eq(0);
        switch (action) {
            case 1://展示
                $(tr).nextUntil('.top').show();
                $(this).attr('action', 2).html('&#xe653;');
                break;
            case 2://收缩
                $(tr).nextUntil('.top').hide();
                $(this).attr('action', 1).html('&#xe652;');
                break;
        }
    })
</script>
</body>
</html>